<template>
	<view class="card_status">
		<uni-card margin="6px" :title="'电站总数 '+stationStatus.count">
			<uni-list :border="false">
				<uni-list-item :border="false" title="接入中电站" :rightText="stationStatus.join+''">
					<template v-slot:header>
						<view class="icon join">
							<text class="iconfont icon-jieruzhongxin"></text>
						</view>
					</template>
				</uni-list-item>
				<!-- <uni-list-item :border="false" title="全部设备离线" :rightText="stationStatus.allOffLineCount+''">
					<template v-slot:header>
						<view class="icon allOffLineCount">
							<text class="iconfont icon-lixian2"></text>
						</view>
					</template>
				</uni-list-item>
				<uni-list-item :border="false" title="部分设备离线" :rightText="stationStatus.partOffLineCount+''">
					<template v-slot:header>
						<view class="icon partOffLineCount">
							<text class="iconfont icon-lixian"></text>
						</view>
					</template>
				</uni-list-item> -->
				<uni-list-item :border="false" title="有报警" :rightText="stationStatus.alarmStationCount+''">
					<template v-slot:header>
						<view class="icon partOffLineCount">
							<text class="iconfont icon-baojing"></text>
						</view>
					</template>
				</uni-list-item>
			</uni-list>
		</uni-card>
	</view>
</template>

<script>
	import {getStationStatus} from "@/common/api/api.js"
	export default {
		components: {},
		data() {
			return {
				stationStatus: {
					join: "--",
					count: "--",
					allOffLineCount: "--",
					partOffLineCount: "--"
				} //电站总数列表
			};
		},
		mounted() {
			this.getStationStatusList()
		},
		methods: {
			async getStationStatusList() {
				const token = uni.getStorageSync('Token')
				getStationStatus({
					token
				}).then((res) => {
					console.log(res)
						this.stationStatus = res.data
				})
			}
		}
	};
</script>

<style scoped lang="scss">
	.card_status {
		.uni-card {
			font-weight: bold;
		}

		.icon {
			height: 50rpx;
			width: 50rpx;
			line-height: 50rpx;
			text-align: center;
			margin-right: 20rpx;
			border-radius: 16rpx;
		}

		.join {
			background-color: #696de133;
			color: #696de1;
			// text {
			// 	font-size: 10rpx;
			// }
		}

		.allOffLineCount {
			background-color: #f58d2033;
			color: #f58d20;
		}

		.partOffLineCount {
			background-color: #ff787433;
			color: #ff7874;
		}
	}
</style>